package homeworks.cjt2009.homework1.io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;

public class TestIO {
//	static 
	
	public static void main(String[] args) {
		File inputFile = new File("C:\\Users\\админ\\Desktop\\test_input.txt");
		File outputFile = new File("C:\\Users\\админ\\Desktop\\test_output.txt");
		Scanner input = null;
		PrintStream output = null;

		try {
			input = new Scanner(inputFile, "UTF-8");
			output = new PrintStream(outputFile, "UTF-8");

			while (input.hasNextLine()) {
				output.println(input.nextLine());
			}

		} catch (NullPointerException npe) {
			System.out.println("The pathname argument of"
					+ " File-constructor is null.");
		} catch (FileNotFoundException fnfe) {
			System.out.println("File not found.");
		} catch (IOException e) {
			System.out.println("Some IOException "
					+ "during reading/writing to files.");
		} finally {
			if (output != null) {
				output.close();
			}

			if (input != null) {
				input.close();
			}
		}
	}
}
